class Cv < ActiveRecord::Base
  validates_presence_of :candidate_name, :cv, :email
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
  validates_uniqueness_of :email
  
protected
  
  def validate
    errors.add(:candidate_name, 'is not a full name.') if self.candidate_name.split(' ').size < 2
  end
end